package flickr;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import org.xml.sax.SAXException;

import com.aetrion.flickr.Flickr;
import com.aetrion.flickr.FlickrException;
import com.aetrion.flickr.photos.Photo;
import com.aetrion.flickr.photos.PhotoList;
import com.aetrion.flickr.tags.HotlistTag;
import com.aetrion.flickr.tags.RelatedTagsList;
import com.aetrion.flickr.tags.Tag;
import com.aetrion.flickr.tags.TagsInterface;
import com.aetrion.flickr.test.TestInterface;

public class Test {

	/**
	 * @param args
	 * @throws FlickrException 
	 * @throws SAXException 
	 * @throws IOException
	 * Flickr API keys: 631188e1e9091309cf3590388dba7891
	 * Flickr API keys (secret): 3cf05c0600c13ee2 
	 */	
	public static void main(String[] args) throws IOException, SAXException, FlickrException {
		String apiKey = "631188e1e9091309cf3590388dba7891";
		Flickr f = new Flickr(apiKey);
		TagsInterface ti = f.getTagsInterface();
		
		//getting related tags given one
//		System.out.println("RELATED");
//		RelatedTagsList tagList = ti.getRelated("china");
//		Iterator<Tag> it = tagList.iterator();
//		while(it.hasNext()) {
//			Tag tag = it.next();
//			System.out.println(tag.getValue());
//		}
		
		
		//getting popular tags
//		System.out.println("HOTLIST");
//		Collection<HotlistTag> hotList = ti.getHotList("week", 300);
//		for (HotlistTag hl : hotList) {
//			System.out.println(hl.getValue() + " " + hl.getScore());
//		}
		
		//getting photo list
//		System.out.println("Photo list");
//		Photo photo = ti.getListPhoto("3461810848");
//		Iterator<Tag> it = photo.getTags().iterator();
//		while(it.hasNext()) {
//			Tag tag = it.next();
//			System.out.println(tag.getValue());
//		}
		
		//getting cluster photos
		System.out.println("Cluster photos");
		PhotoList photolist = ti.getClusterPhotos("communism", "");
		for(Object o : photolist) {
			Photo photo = (Photo) o;
			System.out.println(photo.getUrl());
		}
	}

}
